module ToolsHelper
  def supports_web( args = {})    
    args = { :size => '14x14', :title => '支持网页查询', :alt => '支持网页查询'  }.merge args
    image_tag 'base/funcs/web.png', args
  end
  
  def supports_sms( args = {})
    args = { :size => '14x14', :title => '支持手机短信通知', :alt => '支持手机短信通知' }.merge args
    image_tag 'base/funcs/sms.png', args
  end
  
  def supports_email( args = {})
    args = { :size => '14x14', :title => '支持电子邮件提醒', :alt => '支持电子邮件提醒' }.merge args
    image_tag 'base/funcs/email.png', args
  end
  
  def link_to_tool_by_setting(setting, args = {})
    tool_name = setting.name? ? setting.name : setting.tool.name
    args = {
      :title => "#{setting.tool.tool_type.name}-#{tool_name}【#{setting.tool.version}】-#{sanitize_all setting.tool.synopsis}" ,
      :target => :_blank
    }.merge(args)
    link_to tool_name, tool_url(setting.tool), args    
  end

  def link_to_tool(tool, args = {})
    args.merge!(
      :title => "#{tool.tool_type.name}-#{tool.name}【#{tool.version}】-#{sanitize_all tool.synopsis}" ,
      :target => :_blank
    )
    link_to tool.name, tool_url(tool), args
  end
end
